<div class="row-fluid">
	<div class="span4">
		<form class="form-horizontal" action="/">
			<div class="control-group">
				<label class="control-label" for="inputEmail">Email</label>
				<div class="controls">
					<input type="text" id="inputEmail" placeholder="Email">
				</div>
			</div>			
			<div class="control-group">
				<label class="control-label" for="inputCity">City</label>
				<div class="controls">
					<select id="inputCity">
						<?php foreach($this->components['cities'] as $city): ?>							
								<option value="<?php echo $city['id']?>" <?php if ($city['name'] == 'London') echo 'selected="selected"'?>><?php echo $city['name']; ?></option>
						<?php endforeach; ?>	
						
					</select>
				</div>
			</div>		
			
		</form>
	</div>
</div>
<div class="modal-footer">
			<button class="btn" data-dismiss="modal">
				Close
			</button>
			<button class="btn btn-primary" type="submit" id="send">
				Submit
			</button>
		</div>


<script type="text/javascript">
	$('#send').click(function(){
		 $.post(
			'subscription/update',
			{ email  : $('#inputEmail').val(),
			  cityId : $('#inputCity').val()
			},
			function(data){
				if (data == true){
					window.location = '/';
				}
				else if(data == 'registered'){
					window.location = '/index/index/message/overregistered/type/red';
				}
				else{
					alert(data);
				}
			},
		    'json'
			);
	});
</script>